log using "C:\Users\J.PARK\Dropbox\Discrimination Project_for me\Organizational Diversity\2023 Version_Merging\FINAL\CFA_2016.smcl", replace  

import delimited "C:\Users\J.PARK\Dropbox\DISCRIMINATION PROJECT\FEVS\FEVS_2010-2019\fevs_2016_prdf.csv"
drop if q17=="X"
drop if q17==""
drop if q37=="X"
drop if q37==""
drop if q38=="X"
drop if q38==""
drop if q15=="X"
drop if q15==""
drop if q22=="X"
drop if q22==""
drop if q25=="X"
drop if q25==""
drop if q33=="X"
drop if q33==""
drop if q48==.
drop if q49==.
destring q17, replace
destring q37, replace
destring q38, replace
destring q15, replace
destring q22, replace
destring q25, replace
destring q33, replace
drop if q55=="X"
drop if q55==""
drop if q45=="X"
drop if q45==""
drop if q34=="X"
drop if q34==""
destring q55, replace
destring q45, replace
destring q34, replace
drop if dsuper=="X"
drop if dsuper==""
drop if dsex=="X"
drop if dsex==""
drop if dminority=="X"
drop if dminority==""
gen minority = 0 if dminority=="B"
replace minority = 1 if dminority=="A"
gen gender = 1 if dsex == "B"
replace gender = 0 if dsex == "A"
gen supervisor = 1 if dsuper == "B" 
replace supervisor = 0 if dsuper == "A"
svyset [pweight=postwt]

svy linearized : sem (JUSTICE -> DISTRIBUTIVE, ) (JUSTICE -> PROCEDURAL, ) (JUSTICE -> INTERPERSONAL, ) (DISTRIBUTIVE -> q22, ) (DISTRIBUTIVE -> q25, ) (DISTRIBUTIVE -> q33, ) (PROCEDURAL -> q15, ) (PROCEDURAL -> q17, ) (PROCEDURAL -> q37, ) (PROCEDURAL -> q38, )(INTERPERSONAL -> q48, ) (INTERPERSONAL -> q49, ), standardized latent(JUSTICE DISTRIBUTIVE PROCEDURAL INTERPERSONAL ) nocapslatent

estat gof, stats(all)

predict justice, latent(JUSTICE)

svy linearized : sem (DIVERSITY -> q34, ) (DIVERSITY -> q45, ) (DIVERSITY -> q55, ), standardized latent(DIVERSITY) nocapslatent

estat gof, stats(all)

predict diversity, latent(DIVERSITY)

keep if agency =="AM" | agency =="IB" | agency =="FQ"| agency =="ED" | agency =="DN" | agency =="HU" | agency =="ST" | agency =="EP"  | agency =="EE"| agency =="FC" | agency =="DR" | agency =="FT" | agency =="GS" | agency =="NQ" | agency =="NN" | agency =="CU" | agency =="NL" | agency =="NF" | agency =="NU" | agency =="OM" | agency =="BG" | agency =="RR" | agency =="SE" | agency =="SB" | agency =="SZ" | plevel1 =="DD34" | plevel1 =="DD10" | plevel1 =="DD63" | plevel1 =="DD35" | plevel1 =="DD04" | plevel1 =="DD07" | plevel1 =="DD26" | plevel1 =="DD60" | plevel1 =="AG25" | plevel1 =="CM03" | plevel1 =="CM06" | plevel1 =="CM08" | plevel1 =="CM09" | plevel1 =="CM14" | plevel1 =="HE02" | plevel1 =="HE04" | plevel1 =="HE05" | plevel1 =="HE06" | plevel1 =="HE07" | plevel1 =="HE08" | plevel1 =="HE09" | plevel1 =="HE10" | plevel1 =="HE12" | plevel1 =="HS04" | plevel1 =="HS05" | plevel1 =="HS14" | plevel1 =="HS01" | plevel1 =="HS03" | plevel1 =="HS02" | plevel1 =="HS06" | plevel1 =="HS12" | plevel1 =="HS10" | plevel1 =="DJ15" | plevel1 =="DJ03" | plevel1 =="DJEA" | plevel1 =="DJ12" | plevel1 =="DJ09" | plevel1 =="DJ02" | plevel1 =="DJ08" | plevel1 =="DJ11" | plevel1 =="DL03" | plevel1 =="DL02" | plevel1 =="DL10" | plevel1 =="DL09" | plevel1 =="DL04" | plevel1 =="DL06" | plevel1 =="DL05" | plevel1 =="DL11" |agency =="AF" | agency =="AR" | plevel1 =="IN03" | plevel1 =="IN01" | plevel1 =="IN02" | plevel1 =="IN07" | plevel1 =="IN05" | plevel1 =="IN06" | plevel1 =="IN14" | agency =="NV" | plevel1 =="TRAI" | plevel1 =="TR91" | plevel1 =="TRFD" | plevel1 =="TR93" | plevel1 =="TRAJ" | plevel1 =="TRTG" | plevel1 =="TRAD" | plevel1 =="TD03" | plevel1 =="TD04" | plevel1 =="TD05" | plevel1 =="VA04" | plevel1 =="VA03" | plevel1 =="VA02"

svy linearized : sem (JUSTICE -> DISTRIBUTIVE, ) (JUSTICE -> PROCEDURAL, ) (JUSTICE -> INTERPERSONAL, ) (DISTRIBUTIVE -> q22, ) (DISTRIBUTIVE -> q25, ) (DISTRIBUTIVE -> q33, ) (PROCEDURAL -> q15, ) (PROCEDURAL -> q17, ) (PROCEDURAL -> q37, ) (PROCEDURAL -> q38, )(INTERPERSONAL -> q48, ) (INTERPERSONAL -> q49, ), standardized latent(JUSTICE DISTRIBUTIVE PROCEDURAL INTERPERSONAL ) nocapslatent

estat gof, stats(all)

predict justice2, latent (JUSTICE)

svy linearized : sem (DIVERSITY -> q34, ) (DIVERSITY -> q45, ) (DIVERSITY -> q55, ), standardized latent(DIVERSITY) nocapslatent

estat gof, stats(all)

predict diversity2, latent (DIVERSITY)

sum justice, detail

sum justice2, detail

sum diversity, detail

sum diversity2, detail

corr justice justice2

corr diversity diversity2 

log close 

